<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('品管验货')"/>
    <link rel="stylesheet" th:href="@{/static/js/plugins/jquery-layout/jquery.layout-latest.css}">
</head>
<body class="gray-bg">
<div class="container-div ui-layout-center">
    <div class="row">
        <div class="col-sm-12 search-condition">
            <form id="goodsForm" th:action="@{/examineGoods/list}" class="form-inline">
                <div class="select-list">
                    <ul>
                        <li class="col-sm-3">
                            <label>发货单号：</label>
                            <input type="text" name="deliverNo" />
                        </li>
                        <li class="col-sm-3">
                            <label>订单号：</label>
                            <input type="text" name="poNo" />
                        </li>
                        <li class="col-sm-3">
                            <label>收货单号：</label>
                            <input type="text" name="mblnr" />
                        </li>
                        <li  class="col-sm-3">
                            <button id="goodsSearchBtn" type="button" class="btn btn-primary btn-rounded btn-sm"><i class="fa fa-search"></i>&nbsp;搜索</button>
                            <button class="btn btn-warning btn-rounded btn-sm" type="reset"><i class="fa fa-eraser"></i>&nbsp;重置</button>
                            <button id="goodsAdvancedSearch" type="button" class="btn btn-primary btn-rounded btn-sm" style="display: none"><i class="fa fa-caret-down"></i>&nbsp;高级搜索</button>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-info">
            <div class="col-sm-12 select-info">
                <div class="btn-group hidden-xs toolbar" id="goodsToolBar" role="group">
                    <a class="btn btn-outline btn-success btn-rounded" onclick="toExamineGoods()">
                        <i class="fa fa-edit"></i> 验货
                    </a>
                </div>
                <table id="goods"></table>
            </div>
        </div>
    </div>
</div>
<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<script type="text/javascript" th:src="@{/static/js/plugins/jquery-layout/jquery.layout-latest.js}"></script>

<script type="text/javascript">
    //面向对象
    var searcherBS = Searcher.createBS('#goods',
        [
            {checkbox: true},
            {title: "发货单号",field:"deliverNo"},
            {title: "订单号", field:"poNo"},
            {title: "行项目号", field:"itemNo"},
            {title: "行项目id", field:"poItemId"},
            {title: "收货日期时间", field:"stockTime"},
            {title: "收货数量", field:"shippedQty"},
            {title: "二维码的url", field:"photoUrl"},
            {title: "发货版本", field:"edition"},
            {title: "试用检验状态", field:"status"},
            {title: "同步时间", field:"syncuname"},
            {title: "同步状态", field:"syncstat"},
            {title: "收货单号", field:"mblnr"},
            {title: "收货行项目", field:"zeile"}
        ]
    );
    $(function () {
        initDictDataSel();//初始化所有字典数据
    });
    /**
     * 查询数据
     */
    function refresh() {
        searcherBS.refresh();
    }

    /**
     * 验货
     */
    function toExamineGoods() {
        var rowDatas = searcherBS.getSelectedRows("pkId");
        if (rowDatas.length ==0) {
            Dialog.errorMsg("请选择一行进行验货");
            return;
        }
        Page.ajaxPOST(ctxPath + "/examineGoods/changeStatus", {"pkId" : rowDatas}, function () {
            Dialog.msg("操作成功", function () {
                searcherBS.refresh();
            });
        });
    }
</script>
</body>
</html>